package com.spring.boot.spring.applet;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.spring.boot.spring.service.WechartUserService;
import com.spring.boot.spring.service.impl.UserInfo;


/**
 * @author 张波
 */
@RestController
@RequestMapping("/index")
public class IndexController {
	
	@Resource
	WechartUserService wechartUserService;
	
	@PostMapping("/login")
	public UserInfo index (
			@RequestParam(name = "code") String code,
			@RequestParam(name = "iv") String iv,
			@RequestParam(name = "encryptedData") String encryptedData
			) {
		
		UserInfo user = this.wechartUserService.getUserInfo(code, iv, encryptedData);
		
		return user;
		
	}

}
